<template>
  <div class="dashboard-editor-container">
    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <div>
            <span class="size_mi">{{ ownerTotal }}</span>
            <h5 class="h5_mi">业主</h5>
            <div class="hr_mi"></div>
          </div>
          <pie-chart :getOwnerTotal="getOwnerTotal"/>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <div>
            <span class="size_mi">{{ roomTotal }}</span>
            <h5 class="h5_mi">房屋</h5>
            <div class="hr_mi"></div>
          </div>
          <raddar-chart :getRoomTotal="getRoomTotal"/>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <div>
            <span class="size_mi">0</span>
            <h5 class="h5_mi">员工</h5>
            <div class="hr_mi"></div>
          </div>
          <bar-chart />
        </div>
      </el-col>
    </el-row>

    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <line-chart :chart-data="lineChartData" />
    </el-row>


  </div>
</template>

<script>
import LineChart from './components/LineChart'
import RaddarChart from './components/RaddarChart'
import PieChart from './components/PieChart'
import BarChart from './components/BarChart'
import {getEchartsData} from "@/api/echarts";

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  }
}

export default {
  name: 'DashboardAdmin',
  components: {
    LineChart,
    RaddarChart,
    PieChart,
    BarChart,
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis,
      ownerTotal:0,
      roomTotal: 0
    }
  },
  methods: {
    // 获取访问入组信息
    getRoomTotal(total){
      this.roomTotal = total
    },

    getOwnerTotal(total){
      this.ownerTotal = total
    }
  }
}
</script>

<style lang="scss" scoped>
.h5_mi{
  display: inline-block;
  font-size: 14px;
  margin: 0 0 7px;
  padding: 0;
  text-overflow: ellipsis;
  float: none;
}
.hr_mi{
  display: block;
  height: 1px;
  width: 100%;
  background-color: #dcdfe6;
  position: relative;
  margin-top: 8px;
}
.size_mi{
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 600;
  padding: 3px 8px;
  text-shadow: none;
  border-radius: 0.25em;
  line-height: 1;
  white-space: nowrap;
  background-color: #1ab394;
  color: #FFFFFF;
  margin-left: 4px;
  float: right!important;
}
.dashboard-editor-container {
  padding: 20px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}
@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
